import { http } from '@/library/http'

export default {
  namespaced: true,
  state: {
    // 企业类型
    modes: [],
  },
  getters: {
    modes (state) {
      return state.modes
    }
  },
  actions: {
    // 获取企业类型
    getModes ({ state }) {
      return new Promise((resolve, reject) => {
        if (state.modes.length === 0) {
          http.get('admin/companys/modes')
            .then((result) => {
              state.modes = result.list
              resolve()
            })
            .catch(reject)
        }
      })
    }
  }
}
